package DataBase;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class GetSuppId {

	
	String suppID;
	private int num;
	
	public String getSuppID()
	{
	SQLConnection sc=new SQLConnection();
	
	try {
		PreparedStatement ps = sc.getConnection().prepareStatement("SELECT max(CAST(suppID AS UNSIGNED INTEGER))FROM Supplier ;");	
		
		ResultSet rs=ps.executeQuery();	
		while (rs.next())
		{
			
			suppID=rs.getString(1);
			if(suppID==null){
				num=0;
				
				return Integer.toString(num);
			}
			
	
		}
		ps.close();
		rs.close();
		sc.getConnection().close();
	}
	catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return suppID;
}
}
